﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MVC4CodeSamples
{
    public class CodeSample
    {
        public CodeSample(string title, string location, string changeSet)
        {
            this.Title = title;
            this.ChangeSet = changeSet;
            this.Location = location;
        }
        public string Title { get; set; }
        public string ChangeSet { get; set; }
        public string Location { get; set; }

        private static object SyncLock = new object();
        private static List<CodeSample> _SampleUrls = null;
        public static List<CodeSample> Samples
        {
            get
            {
                // Double check locking here
                if (_SampleUrls == null)
                {
                    lock (SyncLock)
                    {
                        if (_SampleUrls == null)
                        {
                            _SampleUrls = new List<CodeSample>();
                        }

                        //https://mcv4simplifiedcodesamples.codeplex.com/SourceControl/changeset/36281
                        _SampleUrls.Add(new CodeSample("Hello World1", "/Greetings", "36281"));
                        _SampleUrls.Add(new CodeSample("Hello World2", "/Greetings/HelloWorld", "36281"));
                        _SampleUrls.Add(new CodeSample("Hello World2", "/Greetings/HelloWorld/1234", "36281"));

                        //https://mcv4simplifiedcodesamples.codeplex.com/SourceControl/changeset/36283
                       // _SampleUrls.Add(new CodeSample("How to Create Area", "/HTMLHelpers/StandardHtmlHelpers/", "36283"));

                        //http://www.dotnet-tricks.com/Tutorial/mvc/N50P050314-Understanding-HTML-Helpers-in-ASP.NET-MVC.html
                        _SampleUrls.Add(new CodeSample("Standard Html Helpers Samples",
                            "HTMLHelpers/HTMLHelperSample/StandardHtmlHelpers", "36337"));
                        _SampleUrls.Add(new CodeSample("How to Pass Data (Model)From Controller to View", "/HTMLHelpers/HTMLHelperSample/ModelDemo", "36369"));
                        _SampleUrls.Add(new CodeSample("Strongly Typed Html Helpers Samples",
                            "/HTMLHelpers/HTMLHelperSample/StronglyTyped", "36380"));
                        _SampleUrls.Add(new CodeSample("Templated HTML Helpers Samples",
                             "/HTMLHelpers/HTMLHelperSample/Templated", "36383"));

                        _SampleUrls.Add(new CodeSample("Inline HTML Helpers Sample",
                            "/HTMLHelpers/HTMLHelperSample/InlineHelper", "36392"));
                       
                        _SampleUrls.Add(new CodeSample("Custom HTML Helpers Sample",
                            "/HTMLHelpers/HTMLHelperSample/CustomHelper", "36400"));


                        _SampleUrls.Add(new CodeSample("Data Accress using CRUD Template",
                               "/DataAccess/Products/", ""));
                       
                       

                        _SampleUrls.Add(new CodeSample("Sorting Example ",
                           "/DataAccess/Products/IndexSorted", "36414"));

                       
                        _SampleUrls.Add(new CodeSample("Paging Example using X.PagedList.MVC",
                            "/JQueryGrid/Customers/", "36407"));

                        _SampleUrls.Add(new CodeSample("How to Enable paging in MVC",
                             "/DataAccess/Products/PagedSearch", "36423"));


                        _SampleUrls.Add(new CodeSample("JQuery UI Integration Sample using Date Time Picker",
                             "JQUI/JQUISamples/DTPIckerSanple/", "36478"));

                        _SampleUrls.Add(new CodeSample("JQuery UI Integration Sample using Date Time Picker with layout and script bundling",
                             "JQUI/JQUISamples/DTPIckerSanpleWithScriptBundle/", "36479"));

                        _SampleUrls.Add(new CodeSample("How to use single layout file across all Areas",
                            "/miscellaneous/Misc/UnifiedView", ""));
                    }
                }

                return _SampleUrls;

            }

        }
    }

   
}